import { BadRequestException, PipeTransform } from "@nestjs/common";
export class ParseBoolPipe implements PipeTransform<string> {
  transform(value: string) {
    if (value.toLowerCase() === "true") {
      return true;
    } else if (value.toLowerCase() === "false") {
      return false;
    } else {
      throw new BadRequestException("Validation failed (boolean string is expected))");
    }
  }
}
